package com.bigmodel;

import com.bigmodel.entity.QAEntity;
import cn.hutool.core.collection.ListUtil;
import com.bigmodel.contant.*;
import com.bigmodel.util.ExcelUtil;
import com.bigmodel.util.FtlUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main {

    private final static  String OUT_PATH = "C:\\Users\\houyibing\\Desktop\\大模型\\qa\\";

    public static void main(String[] args) {
        createT001();
        createT002();
        createT003();
        createT006();
        createT007();
        createT008();
        createT009();
        createT0010();
        createT0015();
        createT0016();
        createT0017();
        createT0018();
    }

    private static void createT001(){

        String code = "T001";
        String category = "查询amdb配置项";
        List<String> objectList = ListUtil.toList(SystemName.LIST_ARRAY);
        List<String> verbList = ListUtil.toList(VerbName.LIST_ARRAY);

        List<QAEntity> qaEntityList = new ArrayList<>();
        for(String verbName : verbList) {
            for (String objectName : objectList) {
                Map<String, Object> map = new HashMap<>();
                String question = verbName+objectName+"的配置项";  //查询CRM系统的配置项
                map.put("Question", question);
                map.put("verbName", verbName);
                map.put("objectName", objectName);
                String questionContent = FtlUtil.generateContent(map, code+"/prompt.ftl");
                String answerContent = FtlUtil.generateContent(map, code+"/answer.ftl");
                qaEntityList.add(new QAEntity(code,category,questionContent,answerContent));
            }
        }
        ExcelUtil.createExcel(qaEntityList,OUT_PATH+code+".xls");
    }

    private static void createT002(){

        String code = "T002";
        String category = "查询amdb属性";
        List<String> objectList = ListUtil.toList(SystemName.LIST_ARRAY);
        List<String> verbList = ListUtil.toList(VerbName.LIST_ARRAY);
        List<String> attributeList = ListUtil.toList(AttributeName.LIST_ARRAY);

        List<QAEntity> qaEntityList = new ArrayList<>();
        for(String verbName : verbList) {
            for (String objectName : objectList) {
                for (String attributeName : attributeList) {
                    Map<String, Object> map = new HashMap<>();
                    String question = verbName + objectName + "的"+ attributeName;  //查询CRM系统的IP地址
                    map.put("Question", question);
                    map.put("verbName", verbName);
                    map.put("objectName", objectName);
                    map.put("attributeName", attributeName);
                    String questionContent = FtlUtil.generateContent(map, code + "/prompt.ftl");
                    String answerContent = FtlUtil.generateContent(map, code + "/answer.ftl");
                    qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                }
            }
        }
        ExcelUtil.createExcel(qaEntityList,OUT_PATH+code+".xls");
    }


    private static void createT003(){

        String code = "T003";
        String category = "查询amdb关系";
        List<String> objectList = ListUtil.toList(SystemName.LIST_ARRAY);
        List<String> verbList = ListUtil.toList(VerbName.LIST_ARRAY);
        List<String> attributeList = ListUtil.toList(AttributeName.LIST_ARRAY);
        List<String> relationList = ListUtil.toList(RelationName.LIST_ARRAY);

        List<QAEntity> qaEntityList = new ArrayList<>();
        for(String verbName : verbList) {
            for (String objectName : objectList) {
                for (String relationName : relationList) {
                    Map<String, Object> map = new HashMap<>();
                    String question = verbName + objectName + "的"+ relationName;  //查询CRM系统的使用关系
                    map.put("Question", question);
                    map.put("verbName", verbName);
                    map.put("objectName", objectName);
                    map.put("relationName", relationName);
                    String questionContent = FtlUtil.generateContent(map, code + "/prompt.ftl");
                    String answerContent = FtlUtil.generateContent(map, code + "/answer.ftl");
                    qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                }
            }
        }
        ExcelUtil.createExcel(qaEntityList,OUT_PATH+code+".xls");
    }

    private static void createT006(){

        String code = "T006";
        String category = "查看监控指标";
        List<String> objectList = ListUtil.toList(SystemName.LIST_ARRAY);
        List<String> verbList = ListUtil.toList(VerbName.LIST_ARRAY);
        List<String> attributeList = ListUtil.toList(AttributeName.LIST_ARRAY);
        List<String> metricList = ListUtil.toList(MetricName.LIST_ARRAY);

        List<QAEntity> qaEntityList = new ArrayList<>();
        for(String verbName : verbList) {
            for (String objectName : objectList) {
                for (String metricName : metricList) {
                    Map<String, Object> map = new HashMap<>();
                    String question = verbName + objectName + "最近的"+ metricName;  //查询CRM系统最近的平均响应时间
                    map.put("Question", question);
                    map.put("verbName", verbName);
                    map.put("objectName", objectName);
                    map.put("metricName", metricName);
                    String questionContent = FtlUtil.generateContent(map, code + "/prompt.ftl");
                    String answerContent = FtlUtil.generateContent(map, code + "/answer.ftl");
                    qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                }
            }
        }
        ExcelUtil.createExcel(qaEntityList,OUT_PATH+code+".xls");
    }


    private static void createT007(){

        String code = "T007";
        String category = "查看指标异常情况";
        List<String> objectList = ListUtil.toList(SystemName.LIST_ARRAY);
        List<String> verbList = ListUtil.toList(VerbName.LIST_ARRAY);
        List<String> attributeList = ListUtil.toList(AttributeName.LIST_ARRAY);
        List<String> metricList = ListUtil.toList(MetricName.LIST_ARRAY);

        List<QAEntity> qaEntityList = new ArrayList<>();
        for(String verbName : verbList) {
            for (String objectName : objectList) {
                for (String metricName : metricList) {
                    Map<String, Object> map = new HashMap<>();
                    String question = verbName + objectName + "最近的"+ metricName +"异常情况";  //查询CRM系统最近的平均响应时间异常情况
                    map.put("Question", question);
                    map.put("verbName", verbName);
                    map.put("objectName", objectName);
                    map.put("metricName", metricName);
                    String questionContent = FtlUtil.generateContent(map, code + "/prompt.ftl");
                    String answerContent = FtlUtil.generateContent(map, code + "/answer.ftl");
                    qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
                }
            }
        }
        ExcelUtil.createExcel(qaEntityList,OUT_PATH+code+".xls");
    }


    private static void createT008(){

        String code = "T008";
        String category = "查看对象是否有故障";
        List<String> objectList = ListUtil.toList(SystemName.LIST_ARRAY);
        List<String> verbList = ListUtil.toList(VerbName.LIST_ARRAY);
        List<String> attributeList = ListUtil.toList(AttributeName.LIST_ARRAY);
        List<String> metricList = ListUtil.toList(MetricName.LIST_ARRAY);

        List<QAEntity> qaEntityList = new ArrayList<>();
        for(String verbName : verbList) {
            for (String objectName : objectList) {
                Map<String, Object> map = new HashMap<>();
                String question = verbName + objectName + "最近的故障";  //查询CRM系统最近的故障
                map.put("Question", question);
                map.put("verbName", verbName);
                map.put("objectName", objectName);
                String questionContent = FtlUtil.generateContent(map, code + "/prompt.ftl");
                String answerContent = FtlUtil.generateContent(map, code + "/answer.ftl");
                qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
            }
        }
        ExcelUtil.createExcel(qaEntityList,OUT_PATH+code+".xls");
    }


    private static void createT009(){

        String code = "T009";
        String category = "查看某故障解决方案";
        List<String> objectList = ListUtil.toList(SystemName.LIST_ARRAY);
        List<String> verbList = ListUtil.toList(VerbName.LIST_ARRAY);
        List<String> attributeList = ListUtil.toList(AttributeName.LIST_ARRAY);
        List<String> metricList = ListUtil.toList(MetricName.LIST_ARRAY);
        List<String> faultList = ListUtil.toList(FaultName.LIST_ARRAY);

        List<QAEntity> qaEntityList = new ArrayList<>();
        for(String verbName : verbList) {
            for (String faultName : faultList) {
                Map<String, Object> map = new HashMap<>();
                String question = verbName + faultName + "的解决方案";  //查询mysql宕机的解决方案
                map.put("Question", question);
                map.put("verbName", verbName);
                map.put("faultName", faultName);
                String questionContent = FtlUtil.generateContent(map, code + "/prompt.ftl");
                String answerContent = FtlUtil.generateContent(map, code + "/answer.ftl");
                qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
            }
        }
        ExcelUtil.createExcel(qaEntityList,OUT_PATH+code+".xls");
    }


    private static void createT0010(){

        String code = "T0010";
        String category = "查看某故障自愈方案";
        List<String> objectList = ListUtil.toList(SystemName.LIST_ARRAY);
        List<String> verbList = ListUtil.toList(VerbName.LIST_ARRAY);
        List<String> attributeList = ListUtil.toList(AttributeName.LIST_ARRAY);
        List<String> metricList = ListUtil.toList(MetricName.LIST_ARRAY);
        List<String> faultList = ListUtil.toList(FaultName.LIST_ARRAY);

        List<QAEntity> qaEntityList = new ArrayList<>();
        for(String verbName : verbList) {
            for (String faultName : faultList) {
                Map<String, Object> map = new HashMap<>();
                String question = verbName + faultName + "的故障自愈方案";  //查询mysql宕机的故障自愈方案
                map.put("Question", question);
                map.put("verbName", verbName);
                map.put("faultName", faultName);
                String questionContent = FtlUtil.generateContent(map, code + "/prompt.ftl");
                String answerContent = FtlUtil.generateContent(map, code + "/answer.ftl");
                qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
            }
        }
        ExcelUtil.createExcel(qaEntityList,OUT_PATH+code+".xls");
    }

    private static void createT0015(){

        String code = "T0015";
        String category = "查看告警信息";
        List<String> objectList = ListUtil.toList(SystemName.LIST_ARRAY);
        List<String> verbList = ListUtil.toList(VerbName.LIST_ARRAY);
        List<String> attributeList = ListUtil.toList(AttributeName.LIST_ARRAY);
        List<String> metricList = ListUtil.toList(MetricName.LIST_ARRAY);
        List<String> faultList = ListUtil.toList(FaultName.LIST_ARRAY);

        List<QAEntity> qaEntityList = new ArrayList<>();
        for(String verbName : verbList) {
            for (String objectName : objectList) {
                Map<String, Object> map = new HashMap<>();
                String question = verbName + objectName + "最近的告警信息";  //查询CRM系统最近的告警信息
                map.put("Question", question);
                map.put("verbName", verbName);
                map.put("objectName", objectName);
                String questionContent = FtlUtil.generateContent(map, code + "/prompt.ftl");
                String answerContent = FtlUtil.generateContent(map, code + "/answer.ftl");
                qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
            }
        }
        ExcelUtil.createExcel(qaEntityList,OUT_PATH+code+".xls");
    }


    private static void createT0016(){

        String code = "T0016";
        String category = "查看健康度分数";
        List<String> objectList = ListUtil.toList(SystemName.LIST_ARRAY);
        List<String> verbList = ListUtil.toList(VerbName.LIST_ARRAY);
        List<String> attributeList = ListUtil.toList(AttributeName.LIST_ARRAY);
        List<String> metricList = ListUtil.toList(MetricName.LIST_ARRAY);
        List<String> faultList = ListUtil.toList(FaultName.LIST_ARRAY);

        List<QAEntity> qaEntityList = new ArrayList<>();
        for(String verbName : verbList) {
            for (String objectName : objectList) {
                Map<String, Object> map = new HashMap<>();
                String question = verbName + objectName + "最近的健康度";  //查询CRM系统最近的健康度
                map.put("Question", question);
                map.put("verbName", verbName);
                map.put("objectName", objectName);
                String questionContent = FtlUtil.generateContent(map, code + "/prompt.ftl");
                String answerContent = FtlUtil.generateContent(map, code + "/answer.ftl");
                qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
            }
        }
        ExcelUtil.createExcel(qaEntityList,OUT_PATH+code+".xls");
    }


    private static void createT0017(){

        String code = "T0017";
        String category = "查看健康报告";
        List<String> objectList = ListUtil.toList(SystemName.LIST_ARRAY);
        List<String> verbList = ListUtil.toList(VerbName.LIST_ARRAY);
        List<String> attributeList = ListUtil.toList(AttributeName.LIST_ARRAY);
        List<String> metricList = ListUtil.toList(MetricName.LIST_ARRAY);
        List<String> faultList = ListUtil.toList(FaultName.LIST_ARRAY);

        List<QAEntity> qaEntityList = new ArrayList<>();
        for(String verbName : verbList) {
            for (String objectName : objectList) {
                Map<String, Object> map = new HashMap<>();
                String question = verbName + objectName + "最近的健康报告";  //查询CRM系统最近的健康度
                map.put("Question", question);
                map.put("verbName", verbName);
                map.put("objectName", objectName);
                String questionContent = FtlUtil.generateContent(map, code + "/prompt.ftl");
                String answerContent = FtlUtil.generateContent(map, code + "/answer.ftl");
                qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
            }
        }
        ExcelUtil.createExcel(qaEntityList,OUT_PATH+code+".xls");
    }


    private static void createT0018(){

        String code = "T0018";
        String category = "查看扣分项";
        List<String> objectList = ListUtil.toList(SystemName.LIST_ARRAY);
        List<String> verbList = ListUtil.toList(VerbName.LIST_ARRAY);
        List<String> attributeList = ListUtil.toList(AttributeName.LIST_ARRAY);
        List<String> metricList = ListUtil.toList(MetricName.LIST_ARRAY);
        List<String> faultList = ListUtil.toList(FaultName.LIST_ARRAY);

        List<QAEntity> qaEntityList = new ArrayList<>();
        for(String verbName : verbList) {
            for (String objectName : objectList) {
                Map<String, Object> map = new HashMap<>();
                String question = verbName + objectName + "最近的扣分项";  //查询CRM系统最近的健康度
                map.put("Question", question);
                map.put("verbName", verbName);
                map.put("objectName", objectName);
                String questionContent = FtlUtil.generateContent(map, code + "/prompt.ftl");
                String answerContent = FtlUtil.generateContent(map, code + "/answer.ftl");
                qaEntityList.add(new QAEntity(code, category, questionContent, answerContent));
            }
        }
        ExcelUtil.createExcel(qaEntityList,OUT_PATH+code+".xls");
    }

}
